<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Microsoft.Samples.ServiceHosting.StorageClient.BlobProperties>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>
		Blobs</h2>
	<% using (Html.BeginForm("Upload", "Blob", new { storageId = ViewData["storageId"], storageBoxId = ViewData["storageBoxId"] }, FormMethod.Post, new { enctype = "multipart/form-data" }))
		{ %>
	<table>
		<tr>
			<th>
			</th>
			<th>
				Name
			</th>
			<th>
				Size, Kb
			</th>
			<% if (!(bool)ViewData["isContainerPrivate"])
			{%>
			<th>
				Url
			</th>
			<%} %>
		</tr>
		<% foreach (var item in Model)
		 { %>
		<tr>
			<td>
				<%= Html.ActionLink("Download", "Download", new { storageId = ViewData["storageId"], storageBoxId = ViewData["storageBoxId"], itemId = item.Name })%>
				|
				<%= Html.ActionLink("Delete", "DeleteBlob", new { storageId = ViewData["storageId"], storageBoxId = ViewData["storageBoxId"], itemId = item.Name }, new { onclick = "return confirm('Are you sure?')" })%>
			</td>
			<td>
				<%= Html.Encode(item.Name) %>
			</td>
			<td>
				<%= Html.Encode(Math.Round((double)item.ContentLength/1024, 2))  %>
			</td>
			<% if (!(bool)ViewData["isContainerPrivate"])
			{%>
			<td>
				<a href="<%= item.Uri %>" title="<%= item.Uri %>">Link</a>
			</td>
			<%} %>
		</tr>
		<% } %>
	</table>
	<p>
		<label>
			Upload New File</label>
		<input type="file" name="file" id="file" />
		<input type="submit" value="Upload" name="submit" />
		<%} %>
	</p>
	<div>
		<br />
		<%=Html.ActionLink("Back to List of containers", "List", new { storageId = ViewData["storageId"] })%>
	</div>
</asp:Content>
